(* ============================================== *)
(* lexer pour l'analyse lexicale du protocole     *)
(* author Mathieu Barbin                          *)
(* version 1.0.*                                  *)
(* ============================================== *)

{ 
  open ParserProtocole
}

rule lexem_list = parse
  | ['\n']                                    { lexem_list lexbuf }
  | [' ' '\t'] +                              { lexem_list lexbuf }

  | (['$'] ['0'-'9']+ ) as entier             { CODE (int_of_string (String.sub entier 1 ((String.length entier) - 1)))}     
  | (['0'-'1']+) as entier                    { CODE01 entier }
  | (['A'-'Z' 'a'-'z' '_' '\'' '~'] 
       ['A'-'Z' 'a'-'z' '0'-'9' '_' '\'' '~']*)
      as name                                 { IDENT name }
  | (['\"'] [^'\"']* ['\"']) as chaine        { STRING (String.sub chaine 1 ((String.length chaine) - 2)) } 
 
